package com.springboot.autoconfigure.oss.config;

import com.springboot.autoconfigure.oss.annontion.RequiredFiled;
import com.springboot.autoconfigure.oss.service.OssApiService;
import com.springboot.autoconfigure.oss.service.impl.LocalApiServiceImpl;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * @author zehua
 * @date 2023/7/1813:42
 * @Description nginx 配置
 * server {
 * 		listen 9092;
 *
 * 		#location /file/ {
 * 		#	alias D:\\upload\\file\\;
 * 		#	autoindex on;
 * 		#}
 *
 * 		location /file {
 * 			root D:\\upload;
 * 			autoindex on;
 *                }    *
 *}
 *
 */
@Data
@Accessors(chain = true)
@Configuration
@ConfigurationProperties(prefix = "oss.local")
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class LocalConfigPropertis extends AbstractOSSPropertis {

    /**
     * 本地文件夹
     */
    @RequiredFiled
    private String localDir;

    /**
     * 访问路径
     * @return
     */
    @RequiredFiled
    private String domain;

    /**
     * 请求url 前缀
     */
    private String urlPrefix;
    @Override
    public Class<? extends OssApiService> getImpl() {
        return LocalApiServiceImpl.class;
    }
}
